## character(0)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5 ✓ purrr 0.3.4
## ✓ tibble 3.1.2 ✓ dplyr 1.0.7
## ✓ tidyr 1.1.3 ✓ stringr 1.4.0
## ✓ readr 1.4.0 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
## Loading required package: grid
## ========================================
## ComplexHeatmap version 2.8.0
## Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
## Github page: https://github.com/jokergoo/ComplexHeatmap
## Documentation: http://jokergoo.github.io/ComplexHeatmap-reference
##
## If you use it in published research, please cite:
## Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional
## genomic data. Bioinformatics 2016.
##
## The new InteractiveComplexHeatmap package can directly export static
## complex heatmaps into an interactive Shiny app with zero effort. Have a try!
##
## This message can be suppressed by:
## suppressPackageStartupMessages(library(ComplexHeatmap))
## ========================================
## ========================================
## circlize version 0.4.13
## CRAN page: https://cran.r-project.org/package=circlize
## Github page: https://github.com/jokergoo/circlize
## Documentation: https://jokergoo.github.io/circlize_book/book/
##
## If you use it in published research, please cite:
## Gu, Z. circlize implements and enhances circular visualization
## in R. Bioinformatics 2014.
##
## This message can be suppressed by:
## suppressPackageStartupMessages(library(circlize))
## ========================================
## Loading required package: BiocGenerics
## Loading required package: parallel
##
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:parallel':
##
## clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
## clusterExport, clusterMap, parApply, parCapply, parLapply,
## parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:dplyr':
##
## combine, intersect, setdiff, union
## The following objects are masked from 'package:stats':
##
## IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
##
## anyDuplicated, append, as.data.frame, basename, cbind, colnames,
## dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
## grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
## order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
## rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
## union, unique, unsplit, which.max, which.min
##
##
## ========================================
## simplifyEnrichment version 1.2.0
## Bioconductor page: https://bioconductor.org/packages/simplifyEnrichment/
## Github page: https://github.com/jokergoo/simplifyEnrichment
## Documentation: https://jokergoo.github.io/simplifyEnrichment/
## Examples: https://simplifyenrichment.github.io/
##
## This message can be suppressed by:
## suppressPackageStartupMessages(library(simplifyEnrichment))
## ========================================
Prepare dataframes and lists from eggNOG –> topGO –> REVIGO output (BP)
## Length Class Mode
## DE 168 -none- character
## DEDS 115 -none- character
## DS 73 -none- character
## DE 167 -none- character
## DEDS 92 -none- character
## DS 56 -none- character
## DE 194 -none- character
## DEDS 183 -none- character
## DS 68 -none- character
## DE 92 -none- character
## DEDS 68 -none- character
## DS 92 -none- character
## DE 15 -none- character
## DS 26 -none- character
## DE 6 -none- character
## DS 24 -none- character
Upset plots
gseaUpSet <- function(m, ...){
cs = comb_size(m)
topAnno = HeatmapAnnotation(
"Intersections" = anno_barplot(cs, gp = gpar(fill = c("gray", "gray", "gray", mypal_gsea[c(2,1,3)])),
height = unit(3, "cm"), ylim = c(0,max(cs)+100 ),
axis_param = list(gp = gpar(fontsize = 10)),
border = FALSE),
annotation_name_side = "left",
annotation_label = gt_render(c("Intersections")),
gap = unit(2, "mm"))
rightAnno = upset_right_annotation(
m,
axis_param = list( labels_rot = 0),
width = unit(2, "cm"),
annotation_label = gt_render(c("Set")),
gp = gpar(fill = mypal_gsea[c(2,1,3)]))
ups = UpSet(m, set_order = c( "DS","DEDS", "DE"), top_annotation = topAnno, right_annotation = rightAnno)
ht = draw(ups)
od = column_order(ht)
decorate_annotation("Intersections", {
grid.text(cs[od], x = seq_along(cs), y = unit(cs[od], "native") + unit(2, "pt"),
default.units = "native", just = c("bottom"),
gp = gpar(fontsize = 10, col = "#404040"), rot = 0)
})
return(invisible(NULL))
}
GOterm_comb_mat = normalize_comb_mat(list(ab_season_matrix = make_comb_mat(GOterm_Upset_list[c(1:3)]), # abdomen ds effects plot
th_season_matrix = make_comb_mat(GOterm_Upset_list[c(4:6)]),
ab_family_matrix = make_comb_mat(GOterm_Upset_list[c(7:9)]),
th_family_matrix = make_comb_mat(GOterm_Upset_list[c(10:12)]),
ab_sxf_matrix = make_comb_mat(GOterm_Upset_list[c(13:14)]),
th_sxf_matrix = make_comb_mat(GOterm_Upset_list[c(15:16)])))
knitr::kable(sapply(GOterm_comb_mat, comb_size), caption = "Combination matrix of GO terms (position 1 = DE, 2 = DEDS, 3=DS)")
Combination matrix of GO terms (position 1 = DE, 2 = DEDS, 3=DS)
| 110 |
5 |
2 |
11 |
1 |
0 |
0 |
| 101 |
0 |
2 |
2 |
0 |
0 |
0 |
| 011 |
10 |
4 |
10 |
8 |
0 |
0 |
| 100 |
163 |
163 |
181 |
91 |
15 |
6 |
| 010 |
100 |
86 |
162 |
59 |
0 |
0 |
| 001 |
63 |
50 |
56 |
84 |
26 |
24 |




## geneset term_ID description log10_P
## Length:1489 Length:1489 Length:1489 Min. :1.056
## Class :character Class :character Class :character 1st Qu.:1.537
## Mode :character Mode :character Mode :character Median :1.795
## Mean :1.998
## 3rd Qu.:2.212
## Max. :7.699
## NA's :1
## dispensability eliminated
## Min. :0.0000 Min. :0.0000
## 1st Qu.:0.2397 1st Qu.:0.0000
## Median :0.5350 Median :0.0000
## Mean :0.4998 Mean :0.4153
## 3rd Qu.:0.7520 3rd Qu.:1.0000
## Max. :1.0000 Max. :1.0000
## NA's :1 NA's :1
## Length Class Mode
## ab_DE_S 164 -none- character
## ab_DEDS_S 112 -none- character
## ab_DS_S 73 -none- character
## th_DE_S 163 -none- character
## th_DEDS_S 92 -none- character
## th_DS_S 55 -none- character
## Length Class Mode
## ab_DE_F 194 -none- character
## ab_DEDS_F 183 -none- character
## ab_DS_F 68 -none- character
## th_DE_F 92 -none- character
## th_DEDS_F 68 -none- character
## th_DS_F 92 -none- character
## Length Class Mode
## ab_DE_I 15 -none- character
## ab_DS_I 26 -none- character
## th_DE_I 6 -none- character
## th_DS_I 22 -none- character
## Length Class Mode
## DE 168 -none- character
## DEDS 115 -none- character
## DS 73 -none- character
## DE 167 -none- character
## DEDS 92 -none- character
## DS 56 -none- character
## DE 194 -none- character
## DEDS 183 -none- character
## DS 68 -none- character
## DE 92 -none- character
## DEDS 68 -none- character
## DS 92 -none- character
## DE 15 -none- character
## DS 26 -none- character
## DE 6 -none- character
## DS 24 -none- character
## term_ID GOterm ab_DE_S ab_DEDS_S
## Length:1005 Length:1005 Min. :1.221 Min. :1.457
## Class :character Class :character 1st Qu.:1.367 1st Qu.:1.636
## Mode :character Mode :character Median :1.560 Median :1.906
## Mean :1.809 Mean :2.133
## 3rd Qu.:1.931 3rd Qu.:2.404
## Max. :6.301 Max. :4.284
## NA's :817 NA's :893
## ab_DS_S th_DE_S th_DEDS_S th_DS_S
## Min. :1.689 Min. :1.357 Min. :1.678 Min. :1.186
## 1st Qu.:1.849 1st Qu.:1.537 1st Qu.:1.874 1st Qu.:1.318
## Median :2.122 Median :1.726 Median :2.155 Median :1.600
## Mean :2.299 Mean :1.925 Mean :2.344 Mean :1.727
## 3rd Qu.:2.583 3rd Qu.:2.106 3rd Qu.:2.434 3rd Qu.:1.973
## Max. :4.585 Max. :4.553 Max. :5.143 Max. :3.091
## NA's :932 NA's :842 NA's :913 NA's :934
## ab_DE_F ab_DEDS_F ab_DS_F th_DE_F
## Min. :1.354 Min. :1.339 Min. :1.531 Min. :1.432
## 1st Qu.:1.520 1st Qu.:1.550 1st Qu.:1.714 1st Qu.:1.626
## Median :1.741 Median :1.862 Median :1.962 Median :1.877
## Mean :1.944 Mean :2.040 Mean :2.084 Mean :2.370
## 3rd Qu.:2.089 3rd Qu.:2.287 3rd Qu.:2.256 3rd Qu.:2.483
## Max. :5.481 Max. :6.638 Max. :4.553 Max. :7.699
## NA's :811 NA's :822 NA's :937 NA's :913
## th_DEDS_F th_DS_F ab_DE_I ab_DS_I
## Min. :1.461 Min. :1.373 Min. :1.356 Min. :1.469
## 1st Qu.:1.617 1st Qu.:1.543 1st Qu.:1.411 1st Qu.:1.706
## Median :1.778 Median :1.857 Median :1.470 Median :1.990
## Mean :1.961 Mean :1.964 Mean :1.530 Mean :2.087
## 3rd Qu.:2.143 3rd Qu.:2.192 3rd Qu.:1.579 3rd Qu.:2.204
## Max. :3.678 Max. :4.000 Max. :2.055 Max. :3.377
## NA's :937 NA's :913 NA's :990 NA's :979
## th_DE_I th_DS_I
## Min. :1.169 Min. :1.056
## 1st Qu.:1.209 1st Qu.:1.199
## Median :1.274 Median :1.349
## Mean :1.419 Mean :1.424
## 3rd Qu.:1.543 3rd Qu.:1.529
## Max. :2.357 Max. :2.886
## NA's :991 NA's :968
cluster the go terms
## Cluster 963 terms by 'binary_cut'... 132 clusters, used 12.37608 secs.



Prepare dataframes and lists from eggNOG –> topGO –> REVIGO output (MF)
## Length Class Mode
## DE 27 -none- character
## DEDS 20 -none- character
## DS 8 -none- character
## DE 41 -none- character
## DEDS 14 -none- character
## DS 5 -none- character
## DE 43 -none- character
## DEDS 26 -none- character
## DS 7 -none- character
## DE 33 -none- character
## DEDS 7 -none- character
## DS 6 -none- character
## DE 2 -none- character
## DS 3 -none- character
## DE 4 -none- character
## DS 3 -none- character
Upset plots
gseaUpSet <- function(m, ...){
cs = comb_size(m)
topAnno = HeatmapAnnotation(
"Intersections" = anno_barplot(cs, gp = gpar(fill = c("gray", "gray", mypal_gsea[c(2,1,3)])),
height = unit(3, "cm"), ylim = c(0,max(cs)+100 ),
axis_param = list(gp = gpar(fontsize = 10)),
border = FALSE),
annotation_name_side = "left",
annotation_label = gt_render(c("Intersections")),
gap = unit(2, "mm"))
rightAnno = upset_right_annotation(
m,
axis_param = list( labels_rot = 0),
width = unit(2, "cm"),
annotation_label = gt_render(c("Set")),
gp = gpar(fill = mypal_gsea[c(2,1,3)]))
ups = UpSet(m, set_order = c( "DS","DEDS", "DE"), top_annotation = topAnno, right_annotation = rightAnno)
ht = draw(ups)
od = column_order(ht)
decorate_annotation("Intersections", {
grid.text(cs[od], x = seq_along(cs), y = unit(cs[od], "native") + unit(2, "pt"),
default.units = "native", just = c("bottom"),
gp = gpar(fontsize = 10, col = "#404040"), rot = 0)
})
return(invisible(NULL))
}
GOterm_comb_mat = normalize_comb_mat(list(ab_season_matrix = make_comb_mat(GOterm_Upset_list[c(1:3)]), # abdomen ds effects plot
th_season_matrix = make_comb_mat(GOterm_Upset_list[c(4:6)]),
ab_family_matrix = make_comb_mat(GOterm_Upset_list[c(7:9)]),
th_family_matrix = make_comb_mat(GOterm_Upset_list[c(10:12)]),
ab_sxf_matrix = make_comb_mat(GOterm_Upset_list[c(13:14)]),
th_sxf_matrix = make_comb_mat(GOterm_Upset_list[c(15:16)])))
knitr::kable(sapply(GOterm_comb_mat, comb_size), caption = "Combination matrix of GO terms (position 1 = DE, 2 = DEDS, 3=DS)")
Combination matrix of GO terms (position 1 = DE, 2 = DEDS, 3=DS)
| 110 |
0 |
1 |
1 |
1 |
0 |
0 |
| 011 |
1 |
0 |
2 |
0 |
0 |
0 |
| 100 |
27 |
40 |
42 |
32 |
2 |
4 |
| 010 |
19 |
13 |
23 |
6 |
0 |
0 |
| 001 |
7 |
5 |
5 |
6 |
3 |
3 |




## geneset term_ID description log10_P
## Length:375 Length:375 Length:375 Min. :0.716
## Class :character Class :character Class :character 1st Qu.:1.211
## Mode :character Mode :character Mode :character Median :1.434
## Mean :1.603
## 3rd Qu.:1.794
## Max. :8.187
## NA's :1
## dispensability eliminated
## Min. :0.0000 Min. :0.0000
## 1st Qu.:0.0250 1st Qu.:0.0000
## Median :0.2200 Median :0.0000
## Mean :0.2874 Mean :0.1979
## 3rd Qu.:0.5110 3rd Qu.:0.0000
## Max. :0.9860 Max. :1.0000
## NA's :1 NA's :1
## Length Class Mode
## ab_DE_S 26 -none- character
## ab_DEDS_S 20 -none- character
## ab_DS_S 8 -none- character
## th_DE_S 40 -none- character
## th_DEDS_S 14 -none- character
## th_DS_S 5 -none- character
## Length Class Mode
## ab_DE_F 42 -none- character
## ab_DEDS_F 26 -none- character
## ab_DS_F 7 -none- character
## th_DE_F 33 -none- character
## th_DEDS_F 7 -none- character
## th_DS_F 6 -none- character
## Length Class Mode
## ab_DE_I 2 -none- character
## ab_DS_I 3 -none- character
## th_DE_I 4 -none- character
## th_DS_I 3 -none- character
## term_ID GOterm ab_DE_S ab_DEDS_S
## Length:252 Length:252 Min. :1.159 Min. :1.077
## Class :character Class :character 1st Qu.:1.249 1st Qu.:1.164
## Mode :character Mode :character Median :1.425 Median :1.450
## Mean :1.527 Mean :1.649
## 3rd Qu.:1.576 3rd Qu.:1.784
## Max. :3.041 Max. :3.222
## NA's :213 NA's :224
## ab_DS_S th_DE_S th_DEDS_S th_DS_S
## Min. :1.147 Min. :1.260 Min. :1.312 Min. :1.019
## 1st Qu.:1.273 1st Qu.:1.363 1st Qu.:1.372 1st Qu.:1.115
## Median :1.359 Median :1.512 Median :1.841 Median :1.232
## Mean :1.504 Mean :1.637 Mean :2.008 Mean :1.333
## 3rd Qu.:1.656 3rd Qu.:1.788 3rd Qu.:2.533 3rd Qu.:1.387
## Max. :2.208 Max. :3.071 Max. :3.456 Max. :2.538
## NA's :239 NA's :207 NA's :238 NA's :240
## ab_DE_F ab_DEDS_F ab_DS_F th_DE_F
## Min. :1.207 Min. :1.164 Min. :1.114 Min. :1.025
## 1st Qu.:1.401 1st Qu.:1.364 1st Qu.:1.198 1st Qu.:1.165
## Median :1.715 Median :1.619 Median :1.320 Median :1.342
## Mean :1.812 Mean :1.713 Mean :1.474 Mean :1.682
## 3rd Qu.:2.058 3rd Qu.:1.894 3rd Qu.:1.678 3rd Qu.:1.703
## Max. :3.770 Max. :3.398 Max. :2.268 Max. :8.187
## NA's :201 NA's :219 NA's :239 NA's :193
## th_DEDS_F th_DS_F ab_DE_I ab_DS_I
## Min. :1.244 Min. :0.974 Min. :0.9586 Min. :0.7597
## 1st Qu.:1.375 1st Qu.:1.009 1st Qu.:1.0236 1st Qu.:0.8515
## Median :1.434 Median :1.177 Median :1.0975 Median :0.9364
## Mean :1.907 Mean :1.316 Mean :1.1456 Mean :1.2686
## 3rd Qu.:1.581 3rd Qu.:1.526 3rd Qu.:1.2085 3rd Qu.:1.1335
## Max. :5.119 Max. :2.036 Max. :1.6198 Max. :3.7447
## NA's :244 NA's :236 NA's :240 NA's :239
## th_DE_I th_DS_I
## Min. :0.8928 Min. :0.7160
## 1st Qu.:0.9659 1st Qu.:0.8335
## Median :1.0757 Median :0.9710
## Mean :1.2306 Mean :1.2776
## 3rd Qu.:1.5574 3rd Qu.:1.6396
## Max. :1.7696 Max. :2.3098
## NA's :241 NA's :245
cluster the go terms
## Cluster 172 terms by 'binary_cut'... 13 clusters, used 0.4491539 secs.


